/*
 * Created by Jaren at 2023/1/13 21:44
 */
class Global {
  Global._();

  static Global? _instance;

  final Map<String, dynamic> _data = {};

  static Global getInstance() {
    _instance ??= Global._();
    return _instance!;
  }

  dynamic get(String key, [dynamic defaultValue]) {
    if (_data.containsKey(key)) return _data[key];
    return defaultValue;
  }

  void put(String key, dynamic value) {
    _data[key] = value;
  }

  dynamic remove(String key) {
    return _data.remove(key);
  }

  void destroy() {
    _data.clear();
  }
}
